home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr27 / gs26.zip / XFONTS.DOC < prev   
Text File  |  1993-03-28  |  7KB  |  162 lines

  1.    Copyright (C) 1993 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.
  19.  
  20. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  21.  
  22. This file, xfonts.doc, describes the interface between Ghostscript and the
  23. routines that access externally supplied font and text facilities.
  24.  
  25. For an overview of Ghostscript and a list of the documentation files, see
  26. README.
  27.  
  28. ********
  29. ******** Introduction ********
  30. ********
  31.  
  32. Starting with release 2.6, Ghostscript has the ability to use the
  33. character rasterizer provided by the underlying operating system and
  34. window system; specifically, Adobe Type Manager or a TrueType rasterizer
  35. under MS Windows, and the facilities provided by X Windows.  This ability
  36. augments, but does not replace, Ghostscript's own Type 1 rasterizer:
  37. Ghostscript may still use its own rasterizer for very large characters,
  38. characters that are clipped or transformed in unusual ways, and output to
  39. devices other than the screen.
  40.  
  41. Ghostscript interfaces to these platform facilities through a driver-like
  42. interface called the xfont (external font) interface.  Currently, xfont
  43. implementations are associated directly with device drivers; in a future
  44. release, Ghostscript may separate them, so that (for example) it will be
  45. possible to use the platform rasterizer when writing to a file.
  46.  
  47. Please note that beyond this point, this file is likely to be useful only
  48. to a small number of Ghostscript porters and implementors.
  49.  
  50. ********
  51. ******** Types ********
  52. ********
  53.  
  54. gs_char (defined in gsccode.h)
  55.  
  56.     This type represents a character code that appears in a string.
  57. Currently it is always a single byte, but composite fonts or Unicode may
  58. require it to be wider in the future.
  59.  
  60. gs_glyph (defined in gsccode.h)
  61.  
  62.     This type represents a character name like 'period' or 'epsilon'.
  63. From the xfont implementation's point of view, it is just a handle; when
  64. necessary, Ghostscript provides a gs_proc_glyph_name_t procedure (see next
  65. type) to convert it to a string name.
  66.  
  67. gs_proc_glyph_name_t (defined in gsccode.h)
  68.  
  69.     This type represents a procedure that maps a gs_glyph to its
  70. string name; see the description of char_glyph below.
  71.  
  72. gx_xglyph (defined in gsxfont.h)
  73.  
  74.     This type represents a character or glyph code that can be used
  75. with a specific platform font.  Normally it will be a character code that
  76. the implementation of render_char will turn into a 1-character string and
  77. give to the platform's "display string" operation.
  78.  
  79. gx_xfont_procs (declared in gsxfont.h, defined in gxxfont.h)
  80.  
  81.     This type is the xfont analogue of gx_device_procs, the type of
  82. the procedure record that defines an xfont implementation.
  83.  
  84. gx_xfont (declared in gsxfont.h, defined in gxxfont.h)
  85.  
  86.     This type is the gxfont analogue of gx_device, the type of the
  87. basic structure for an xfont.
  88.  
  89. (encoding_index)
  90.  
  91.     This is not really a type, although it probably should be: it is
  92. an int used to indicate the Encoding used by a font.  Defined values are
  93.     0 = StandardEncoding
  94.     1 = ISOLatin1Encoding
  95.     2 = SymbolEncoding
  96.     -1 = other encoding
  97.  
  98. ********
  99. ******** Implementation procedures ********
  100. ********
  101.  
  102. All the procedures that return int results return 0 on success, or an
  103. appropriate negative error code in the case of error conditions.  The
  104. error codes are defined in gserrors.h.  The relevant ones are the same as
  105. for drivers (see drivers.doc for details).
  106.  
  107. As for driverse, if an implementation procedure returns an error, it
  108. should use the return_error macro rather than a simple return statement,
  109. e.g.,
  110.  
  111.     return_error(gs_error_VMerror);
  112.  
  113. This macro is defined in gx.h, which is automatically included by
  114. gdevprn.h but not by gserrors.h.
  115.  
  116. Font-level
  117. ----------
  118.  
  119. gx_xfont *(*lookup_font)(P7(gx_device *dev, const byte *fname, uint len,
  120.   int encoding_index, const gs_uid *puid, const gs_matrix *pmat,
  121.   const gs_memory_procs *mprocs))
  122.  
  123.     Look up a font name, UniqueID, and matrix, and return an xfont, or
  124. NULL if no suitable xfont exists.  Use mprocs to allocate the xfont and
  125. any subsidiary data structures.  The matrix is the FontMatrix concatenated
  126. with the CTM, so (roughly speaking) the font size in pixels is pmat->yy *
  127. 1000 for a normal Type 1 font.
  128.  
  129.     Note that this is the only implementation procedure that does not
  130. take an xfont * as its first argument.
  131.  
  132. gx_xglyph (*char_xglyph)(P5(gx_xfont *xf, gs_char chr, int encoding_index,
  133.   gs_glyph glyph, gs_proc_glyph_name_t glyph_name))
  134.  
  135.     Convert a character name to an xglyph code.  In the case of
  136. glyphshow, chr may be gs_no_char; for an ordinary show operation, if
  137. the character code is invalid, glyph may be gs_no_glyph.
  138.  
  139. int (*char_metrics)(P5(gx_xfont *xf, gx_xglyph xg, int wmode,
  140.   gs_int_point *pwidth, gs_int_rect *pbbox))
  141.  
  142.     Get the metrics for a character.
  143.  
  144. int (*render_char)(P7(gx_xfont *xf, gx_xglyph xg, gx_device *target,
  145.   int x, int y, gx_color_index color, int required))
  146.  
  147.     Render a character.  (x,y) corresponds to the character origin.
  148. The target may be any Ghostscript device.  A good implementation will
  149. check whether the target can handle this type of xfont directly (e.g., by
  150. checking the target name), and if so, will render the character directly;
  151. otherwise, it will do what has to be done in the general case, namely, get
  152. a bitmap for the character and use the target's copy_mono operation.  If
  153. required is false, the procedure should return an error if the rendering
  154. operation would be expensive, since in this case Ghostscript has already
  155. cached the bitmap and metrics from a previous call with required=true.
  156.  
  157. int (*release)(P2(gx_xfont *xf, const gs_memory_procs *mprocs))
  158.  
  159.     Release any external resources associated with an xfont.  If
  160. mprocs is not NULL, also free any storage allocated by lookup_font
  161. (including the xfont itself).
  162.